﻿using System;
using UnityEngine.Events;
using UnityEngine.UI;

namespace SizeboxUI
{
	// Token: 0x020003B0 RID: 944
	public class LightingView : SettingsView
	{
		// Token: 0x06001935 RID: 6453 RVA: 0x0009E564 File Offset: 0x0009C764
		private void Start()
		{
			base.GetComponentInChildren<Text>().text = "Lighting";
			this.time = base.AddSlider("Time", 0f, 359.99f);
			this.time.onValueChanged.AddListener(new UnityAction<float>(this.OnTimeChanged));
			this.timeLabel = this.time.transform.parent.GetComponentInChildren<Text>();
			this.sunAngle = base.AddSlider("Sun Angle", 0f, 359.99f);
			this.sunAngle.onValueChanged.AddListener(new UnityAction<float>(this.OnSunAngleChanged));
			this.sunAngleLabel = this.sunAngle.transform.parent.GetComponentInChildren<Text>();
			this.realtimeDayAndNight = base.AddToggle("Realtime Day and Night");
			this.realtimeDayAndNight.onValueChanged.AddListener(new UnityAction<bool>(this.OnRealtimeDayAndNightChanged));
			this.dayTimeScale = base.AddSlider("Day Time Scale", 0.1f, 10f);
			this.dayTimeScale.onValueChanged.AddListener(new UnityAction<float>(this.OnDayTimeScaleSliderChanged));
			this.dayTimeScaleLabel = this.dayTimeScale.transform.parent.GetComponentInChildren<Text>();
			this.UpdateValues();
		}

		// Token: 0x06001936 RID: 6454 RVA: 0x0009E6AA File Offset: 0x0009C8AA
		private void OnEnable()
		{
			if (this.dayTimeScaleLabel != null)
			{
				this.UpdateValues();
			}
		}

		// Token: 0x06001937 RID: 6455 RVA: 0x0009E6C4 File Offset: 0x0009C8C4
		protected override void UpdateValues()
		{
			this.time.value = SimpleSunController.SunX;
			this.timeLabel.text = "Time (" + SimpleSunController.SunX.ToString("0.00") + ")";
			this.sunAngle.value = SimpleSunController.SunY;
			this.sunAngleLabel.text = "Sun Angle (" + SimpleSunController.SunY.ToString("0.00") + ")";
			this.realtimeDayAndNight.isOn = SimpleSunController.UseRealtimeDayAndNight;
			this.dayTimeScale.value = SimpleSunController.DayTimeScale;
			this.dayTimeScaleLabel.text = "Day Time Scale (" + SimpleSunController.DayTimeScale.ToString("0.00") + ")";
		}

		// Token: 0x06001938 RID: 6456 RVA: 0x0009E795 File Offset: 0x0009C995
		private void OnTimeChanged(float val)
		{
			SimpleSunController.SunX = val;
			this.timeLabel.text = "Time (" + val.ToString("0.00") + ")";
		}

		// Token: 0x06001939 RID: 6457 RVA: 0x0009E7C3 File Offset: 0x0009C9C3
		private void OnSunAngleChanged(float val)
		{
			SimpleSunController.SunY = val;
			this.sunAngleLabel.text = "Sun Angle (" + val.ToString("0.00") + ")";
		}

		// Token: 0x0600193A RID: 6458 RVA: 0x0009E7F1 File Offset: 0x0009C9F1
		private void OnRealtimeDayAndNightChanged(bool val)
		{
			SimpleSunController.UseRealtimeDayAndNight = val;
		}

		// Token: 0x0600193B RID: 6459 RVA: 0x0009E7F9 File Offset: 0x0009C9F9
		private void OnDayTimeScaleSliderChanged(float val)
		{
			SimpleSunController.DayTimeScale = val;
			this.dayTimeScaleLabel.text = "Day Time Scale (" + val.ToString("0.00") + ")";
		}

		// Token: 0x04001B50 RID: 6992
		private Slider time;

		// Token: 0x04001B51 RID: 6993
		private Text timeLabel;

		// Token: 0x04001B52 RID: 6994
		private Slider sunAngle;

		// Token: 0x04001B53 RID: 6995
		private Text sunAngleLabel;

		// Token: 0x04001B54 RID: 6996
		private Toggle realtimeDayAndNight;

		// Token: 0x04001B55 RID: 6997
		private Slider dayTimeScale;

		// Token: 0x04001B56 RID: 6998
		private Text dayTimeScaleLabel;
	}
}
